package com.yxy.dao;

import java.util.List;
import com.yxy.entity.Sport;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;


/**
 *
 * SportDao
 *
 * @version
 * <pre>
 * Author	Version		Date		Changes
 * 邓文俊 	1.0  	2018-01-11 16:28:27	 	Created
 *
 * </pre>
 * @since 1.
 */
@Repository
public interface SportDao {
    /**
     * 单个新增
     *
     * @param entity
     * @return
     */
    int insert(Sport entity);

    /**
     * 单个更新
     *
     * @param entity
     * @return
     */
    int updateByPrimaryKey(Sport entity);

    /**
     * 单个删除
     *
     * @param entity
     * @return
     */
    int deleteByPrimaryKey(Sport entity);



    /**
     * 查询列表
     *
     * @param entity
     * @return
     */
    List<Sport> selectAll(Sport entity);

    /**
     * 根据id查询
     *
     * @param entity
     * @return
     */
    Sport select(Sport entity);


    /**
     * 批量新增
     *
     * @param list
     * @return
     */
    int insertBatch(List<Sport> list);

    /**
     * 批量删除
     *
     * @param list
     * @return
     */
    int deleteBatch(List<Sport> list);

    /**
     * 根据id,查询运动详情及发布人昵称，头像
     * @param id
     * @return
     */
    Sport findOne(Integer id);


    /**
     * 建立参加用户与运动关系
     * @param userId
     * @param sportId
     * @return
     */
    int insertUserSportRelationship(@Param("userId")Integer userId, @Param("sportId") Integer sportId);

    int selectUserSportRelationship(@Param("userId")Integer userId, @Param("sportId") Integer sportId);

    int deleteUserSportRelationship(@Param("userId")Integer userId, @Param("sportId") Integer sportId);

   List<Sport> selectListByUserId(Integer userId);

   List<Sport> selectIJoinSports(Integer userId);


    int insertUserLove(@Param("userId")Integer userId, @Param("sportTypeId") Integer sportTypeId);

    List<Integer> selectLoveSportTypeIdList(@Param("userId")Integer userId);

    List<Sport> selectLoveSportList(List sportTypeIdList);



}